package com.example.xd.default_call.fragment

import android.telecom.Call
import android.view.View
import com.example.xd.default_call.R
import com.example.xd.default_call.UIService
import com.example.xd.default_call.eventbus_msg.MultCallInMsg
import kotlinx.android.synthetic.main.fragment_mult_call_in.*
import org.greenrobot.eventbus.EventBus

/**
 * @auther XuDan on 2020/8/25.
 */
class MultCall_In_Fragment : BaseFragment(), View.OnClickListener {
    override fun registerMethod() {
        TODO("Not yet implemented")
    }

    override fun getLayoutId(): Int {
        return R.layout.fragment_mult_call_in
    }

    lateinit var call1: Call
    lateinit var call2: Call
    override fun initViews(view: View) {
        btn_mult_cut_current.setOnClickListener(this)
        btn_mult_cut.setOnClickListener(this)
        btn_mult_in.setOnClickListener(this)
        call1 = UIService.call_list.get(0)
        call2 = UIService.call_list.get(1)
        tv_call1.text = call1.details.handle.toString().substring(4).replace("%20", "")
        tv_call2.text = call2.details.handle.toString().substring(4).replace("%20", "")

    }

    override fun unRegisterMethod() {
        TODO("Not yet implemented")
    }

    override fun onClick(v: View) {
        when (v) {
            btn_mult_cut_current -> {
                call1.disconnect()
                mult_ll1.visibility = View.GONE

            }
            btn_mult_cut -> {
                call2.disconnect()
            }
            btn_mult_in -> {
            }
        }
    }
}